!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):n.Splitting=t()}(this,function(){"use strict" var o=document,l=o.createTextNode.bind(o) function d(n,t,e){n.style.setProperty(t,e)}function f(n,t){return n.appendChild(t)}function p(n,t,e,r){var i=o.createElement("span") return t&&(i.className=t),e&&(!r&&i.setAttribute("data-"+t,e),i.textContent=e),n&&f(n,i)||i}function h(n,t){return n.getAttribute("data-"+t)}function m(n,t){return n&&0!=n.length?n.nodeName?[n]:[].slice.call(n[0].nodeName?n:(t||o).querySelectorAll(n)):[]}function u(n){for(var t=[];n--;)t[n]=[] return t}function v(n,t){n&&n.some(t)}function c(t){return function(n){return t[n]}}var a={} function n(n,t,e,r){return{by:n,depends:t,key:e,split:r}}function r(n){return function t(e,n,r){var i=r.indexOf(e) if(-1==i){r.unshift(e) var o=a[e] if(!o)throw new Error("plugin not loaded: "+e) v(o.depends,function(n){t(n,e,r)})}else{var u=r.indexOf(n) r.splice(i,1),r.splice(u,0,e)}return r}(n,0,[]).map(c(a))}function t(n){a[n.by]=n}function g(n,r,i,o,u){n.normalize() var c=[],a=document.createDocumentFragment() o&&c.push(n.previousSibling) var s=[] return m(n.childNodes).some(function(n){if(!n.tagName||n.hasChildNodes()){if(n.childNodes&&n.childNodes.length)return s.push(n),void c.push.apply(c,g(n,r,i,o,u)) var t=n.wholeText||"",e=t.trim() e.length&&(" "===t[0]&&s.push(l(" ")),v(e.split(i),function(n,t){t&&u&&s.push(p(a,"whitespace"," ",u)) var e=p(a,r,n) c.push(e),s.push(e)})," "===t[t.length-1]&&s.push(l(" ")))}else s.push(n)}),v(s,function(n){f(a,n)}),n.innerHTML="",f(n,a),c}var s=0 var i="words",e=n(i,s,"word",function(n){return g(n,"word",/\s+/,0,1)}),y="chars",w=n(y,[i],"char",function(n,e,t){var r=[] return v(t[i],function(n,t){r.push.apply(r,g(n,"char","",e.whitespace&&t))}),r}) function b(e){var f=(e=e||{}).key return m(e.target||"[data-splitting]").map(function(a){var s=a["🍌"] if(!e.force&&s)return s s=a["🍌"]={el:a} var n=e.by||h(a,"splitting") n&&"true"!=n||(n=y) var t=r(n),l=function(n,t){for(var e in t)n[e]=t[e] return n}({},e) return v(t,function(n){if(n.split){var t=n.by,e=(f?"-"+f:"")+n.key,r=n.split(a,l,s) e&&(i=a,c=(u="--"+e)+"-index",v(o=r,function(n,t){Array.isArray(n)?v(n,function(n){d(n,c,t)}):d(n,c,t)}),d(i,u+"-total",o.length)),s[t]=r,a.classList.add(t)}var i,o,u,c}),a.classList.add("splitting"),s})}function N(n,t,e){var r=m(t.matching||n.children,n),i={} return v(r,function(n){var t=Math.round(n[e]);(i[t]||(i[t]=[])).push(n)}),Object.keys(i).map(Number).sort(x).map(c(i))}function x(n,t){return n-t}b.html=function(n){var t=(n=n||{}).target=p() return t.innerHTML=n.content,b(n),t.outerHTML},b.add=t var T=n("lines",[i],"line",function(n,t,e){return N(n,{matching:e[i]},"offsetTop")}),L=n("items",s,"item",function(n,t){return m(t.matching||n.children,n)}),k=n("rows",s,"row",function(n,t){return N(n,t,"offsetTop")}),A=n("cols",s,"col",function(n,t){return N(n,t,"offsetLeft")}),C=n("grid",["rows","cols"]),M="layout",S=n(M,s,s,function(n,t){var e=t.rows=+(t.rows||h(n,"rows")||1),r=t.columns=+(t.columns||h(n,"columns")||1) if(t.image=t.image||h(n,"image")||n.currentSrc||n.src,t.image){var i=m("img",n)[0] t.image=i&&(i.currentSrc||i.src)}t.image&&d(n,"background-image","url("+t.image+")") for(var o=e*r,u=[],c=p(s,"cell-grid");o--;){var a=p(c,"cell") p(a,"cell-inner"),u.push(a)}return f(n,c),u}),H=n("cellRows",[M],"row",function(n,t,e){var r=t.rows,i=u(r) return v(e[M],function(n,t,e){i[Math.floor(t/(e.length/r))].push(n)}),i}),O=n("cellColumns",[M],"col",function(n,t,e){var r=t.columns,i=u(r) return v(e[M],function(n,t){i[t%r].push(n)}),i}),j=n("cells",["cellRows","cellColumns"],"cell",function(n,t,e){return e[M]}) return t(e),t(w),t(T),t(L),t(k),t(A),t(C),t(S),t(H),t(O),t(j),b}); window.addEventListener('DOMContentLoaded', () => { class SPLIT extends elementorModules.frontend.handlers.Base { bindEvents() { if(this.getElementSettings('ui_animate_split') === 'ui-split-animate'){ this.split(); this.animate(); } } onElementChange(prop) { var is_split = (this.getElementSettings('ui_animate_split') === 'ui-split-animate') if(prop === 'ui_animate_split' && is_split){ this.unsplit(); setTimeout(() => { this.split() }, 100); } if(prop === 'ui_animate_split_by' && is_split){ this.unsplit(); setTimeout(() => { this.split() }, 100); } if(is_split){ if (prop.indexOf('ui_animate') !== -1) { this.$element.find('.'+this.get_split(false)) .attr('class',this.get_split(false)+'') setTimeout(() => { this.animate(); }, 150); } }else if(prop === 'ui_animate_split'){ this.unsplit(); } return; } split(){ let animation = this.getElementSettings('ui_animate_split_style') let split = this.get_split(); let el = this.$element.find('.elementor-widget-container > *:not(style)'); if(el.length == 0) { this.$element.find('.elementor-widget-container').wrapInner('
'); el = this.$element.find('.elementor-widget-container > *:not(style)'); } Splitting({ target: el, by: split, key: 'ui-' }); el.addClass('ui-e-'+animation); } unsplit() { const content = this.$element.find('.elementor-widget-container > *:not(style)')[0] let transformedMarkup = content.innerHTML; this.$element.find('.elementor-widget-container > *:not(style)')[0].innerHTML = transformedMarkup .replace(/(\s)<\/span>/g, "$1") .replace( /(\S+)<\/span>/g, "$1" ) .replace(/ aria-hidden="true"/g, "") .replace( /(\S+)<\/span>/g, "$2" ); content.classList.remove("splitting"); } animate(){ let $el = jQuery(this.$element) let animation = this.getElementSettings('ui_animate_split_style') var animateChild = this.$element.find('.'+this.get_split(false)) let el = this.$element.find('.elementor-widget-container > *:not(style)'); jQuery(this.$element).addClass('elementor-invisible'); animateChild.removeClass(animation); el.addClass('ui-e-'+animation); if(typeof Waypoint != 'undefined'){ new Waypoint({ element: el, handler: function (direction) { $el.css('opacity',1); setTimeout(() => { el.removeClass('ui-e-'+animation); }, 100); animateChild.addClass('ui-e-animated'); animateChild.addClass(animation); }, offset: "90%", }); }else{ $el.css('opacity',1); setTimeout(() => { el.removeClass('ui-e-'+animation); }, 200); animateChild.addClass('ui-e-animated'); animateChild.addClass(animation); } setTimeout(() => { jQuery(this.$element).removeClass('elementor-invisible'); }, 1); } get_split(asClass = true){ let split = this.getElementSettings('ui_animate_split_by') if(!asClass){ split = (split === 'lines') ? 'words' : split return split.slice(0, -1); } return split } } jQuery(window).on('elementor/frontend/init', () => { const addHandler = ($element) => { elementorFrontend.elementsHandler.addHandler(SPLIT, { $element, }); }; elementorFrontend.hooks.addAction('frontend/element_ready/heading.default', addHandler); elementorFrontend.hooks.addAction('frontend/element_ready/text-editor.default', addHandler); elementorFrontend.hooks.addAction('frontend/element_ready/uicore-the-title.default', addHandler); elementorFrontend.hooks.addAction('frontend/element_ready/uicore-page-description.default', addHandler); elementorFrontend.hooks.addAction('frontend/element_ready/highlighted-text.default', addHandler); }); }, false)